define(['app'], function(app) {
    'use strict';

    var controller = function controller($scope, Afback,$stateParams) {
		
		$scope.input = new Object();
		$scope.order_id = $stateParams.order_id;

		$scope.input.reason = "";
		$scope.input.reason_items = [{id:1,name:"质量问题"},{id:2,name:"货品和描述不符"}];
        $scope.input.reason_select = {id:0,name:"请选择退货原因"};


		$scope.input.type = "";
		$scope.input.type_items =  [{id:1,name:"退款"},{id:2,name:"退货"},{id:3,name:"换货"}];
		$scope.input.type_select = {id:0,name:"请选择需要的服务"};

		$scope.input.money = "";
		$scope.input.money_items = [{id:1,name:"100"},{id:2,name:"200"},{id:3,name:"300"}];
		$scope.input.money_select = {id:0,name:"请选择要退还的运费"};

		
		$scope.get_submit = function(){
			console.log($scope.input);
			Afback.af_back($scope.order_id,$scope.input.type,$scope.input.reason,$scope.input.money,$scope.input.instructions,'phone',function(data){
				
			})
		}
		
		$scope.doSelectReason = function(){
			//id是值 name是显示
			GoDialog.showSelect("请选择退货原因",$scope.input.reason_items,$scope.input.reason_select,function(data){
				$scope.input.reason = data.id;
				$scope.input.reason_select = data;
			});
		}
		$scope.doSelectType = function(){
			//id是值 name是显示
			GoDialog.showSelect("请选择需要的服务",$scope.input.type_items,$scope.input.type_select,function(data){
				$scope.input.type = data.id;
				$scope.input.type_select = data;
			});
		}
		$scope.doSelectMoney = function(){
			//id是值 name是显示
			GoDialog.showSelect("请选择要退还的运费",$scope.input.money_items,$scope.input.money_select,function(data){
				$scope.input.money = data.id;
				$scope.input.money_select = data;
			});
		}
		
		
    }

    controller.$inject = ['$scope', 'Afback','$stateParams'];

    return app.registerController("afbackctrl",controller);
});